//
//  YJLoginVC.m
//  YJB
//
//  Created by 中电大维 on 16/5/12.
//  Copyright © 2016年 YJB. All rights reserved.
//

#import "YJLoginVC.h"
#import "YJLoginView.h"
#import "YJRegistVC.h"
#import "YJNetworkTool.h"
#import "YJGetVerificationVC.h"
#import "YJUserDefaultTool.h"
#import "YJNetworkTool.h"
//友盟统计工具
//#import "UMMobClick/MobClick.h"
#import "YJGlobalHeader.h"

@interface YJLoginVC ()
@end

@implementation YJLoginVC

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = YES;
    self.tableView.scrollEnabled = NO;
    self.tableView.tableFooterView = [UIView new];
    YJLoginView *loginView = [[YJLoginView alloc]init];
    loginView.frame = CGRectMake(0, 0, IPHONE_W, IPHONE_H);
    self.tableView.tableHeaderView = loginView;
    
    //注册
    @weakify(self)
    [loginView.registSignal subscribeNext:^(id x) {
        @strongify(self)
        YJGetVerificationVC *getVerificationVC = [[YJGetVerificationVC alloc] init];
        getVerificationVC.isRegister = YES;
        [self.navigationController pushViewController:getVerificationVC animated:YES];
    }];
    //忘记密码
    [loginView.forgetSignal subscribeNext:^(id x) {
        @strongify(self)
        YJGetVerificationVC *getVerificationVC = [[YJGetVerificationVC alloc] init];
        getVerificationVC.isRegister = NO;
        [self.navigationController pushViewController:getVerificationVC animated:YES];
    }];
    //键盘通知
    [[[NOTIFICATIONCENTER rac_addObserverForName:UIKeyboardWillShowNotification object:nil] takeUntil:self.rac_willDeallocSignal]subscribeNext:^(id x) {
        @strongify(self)
       self.tableView.scrollEnabled = YES;
    }];
    [[[NOTIFICATIONCENTER rac_addObserverForName:UIKeyboardWillHideNotification object:nil] takeUntil:self.rac_willDeallocSignal]subscribeNext:^(id x) {
        @strongify(self)
       self.tableView.scrollEnabled = NO;
    }];
}

@end
